package springboot.demo.mybatisplus.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springboot.demo.mybatisplus.entity.Money;
import springboot.demo.mybatisplus.service.IMoneyService;

import javax.annotation.Resource;

/**
 * @author lweiqiang
 * @date 2023/2/27
 */
@Slf4j
@RestController
@RequestMapping("/money")
public class MoneyController {

  @Resource private IMoneyService moneyService;

  @PutMapping("/add")
  public Object add(@RequestBody Money money) {
    return moneyService.save(money);
  }

  @GetMapping("/get")
  public Object getById(@RequestParam Long id) {
    return moneyService.getById(id);
  }
}
